package com.huaxun.edu.web.stu;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.optix.common.app.AppContext;
import net.optix.common.app.BaseAction;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

import com.huaxun.edu.model.TBE_BJ;
import com.huaxun.edu.model.TBE_Circle;
import com.huaxun.edu.ucc.IBJUCC;
import com.huaxun.edu.ucc.IJBUCC;

@ParentPackage(value = "basic")
@Namespace(value = "/stu")
@Action(value = "stuManage", results = { @Result(name = "success", type = "theme", location = "/resource/edu/stu/stuManage.html") })
// @HLFunction(title = "学校管理", type = "系统管理")
public class StuManageAction extends BaseAction {

	private Map<String, List<TBE_BJ>> bjs = new HashMap<String, List<TBE_BJ>>();

	private List<TBE_Circle> jbs;

	private String xxdm;

	public String execute() {

		IJBUCC jbUCC = AppContext.getService("jbUCC", IJBUCC.class);
		jbs = jbUCC.findAllJBs(xxdm);

		IBJUCC bjUCC = AppContext.getService("bjUCC", IBJUCC.class);
		List<TBE_BJ> list = bjUCC.findAllBJs(xxdm);
		if (null != list) {
			for (TBE_BJ bj : list) {
				if (!bjs.containsKey(bj.getJb())) {
					bjs.put(bj.getJb(), new ArrayList<TBE_BJ>());
				}
				bjs.get(bj.getJb()).add(bj);
			}
		}
		return success;
	}

	public Map<String, List<TBE_BJ>> getBjs() {
		return bjs;
	}

	public void setBjs(Map<String, List<TBE_BJ>> bjs) {
		this.bjs = bjs;
	}

	public List<TBE_Circle> getJbs() {
		return jbs;
	}

	public void setJbs(List<TBE_Circle> jbs) {
		this.jbs = jbs;
	}

	public String getXxdm() {
		return xxdm;
	}

	public void setXxdm(String xxdm) {
		this.xxdm = xxdm;
	}

}